<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../../../inc/conn.asp"-->
<!--#include file="../../../inc/md5.asp"-->
<!--#include file="../common/u.asp"-->
<%links="security"
if session("code")="" then response.Redirect "/user/security/mail"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>账户安全</title>
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon"/>
<link rel="stylesheet" type="text/css" href="/css/style.css" />
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/jquery.tabs.js"></script>
<script language="javascript" type="text/javascript" src="/js/pd.js"></script>
<script>
function myjobchk(){
if (document.formcn.password.value=="")
{alert("当前密码不能为空");
document.formcn.password.focus();
return false;
}
if (document.formcn.newmail.value=="")
{alert("新邮箱不能为空");
document.formcn.newmail.focus();
return false;
}
if(!CheckEmail(formcn.newmail.value)){
alert("新邮箱输入错误");
formcn.newmail.focus();
return false;
}
if(formcn.newmail2.value=="" || formcn.newmail2.value!=formcn.newmail.value){
alert("两次输入新邮箱不一致")
formcn.newmail2.focus()
return(false)
}   
return(true);
}
</script>
</head>
<body>

<!--#include file="../../common/top.asp"-->

<div class="fullwidth">
	<div class="place ">
		<a href="/">首页</a> &gt; <a href="/user">会员中心</a> &gt; 账户安全
	</div>
</div>
<!--main-->
<div class="fullwidth bg1">
	<div class="main">
		
		
        
         <!--#include file="../common/left.asp"-->
        
        
		
		<div class="right_show f_r">
			
			<div class="title_4">
				<h2>账户安全</h2><div></div>
			</div>
			<div class="reg_box reg_s_1 account order_tab order_tab_3">
				<ul class="tab_menu">
					<li><a href="/user/security">密码修改</a></li>
					<li class="current">邮箱修改</li>
				</ul>
				<div class="tab_box">
					<div class="hide">
						<div class="clear20"></div>
						<div class="clear20"></div>
						
						<div class="clear20"></div>
					</div>
					<div>						
						<div class="clear20"></div>
						<div class="clear20"></div>
						<div class="width700"> 
							<div class="passet_step passet_step_1">
								<ul>
									<li class="rs_1">邮箱验证码验证</li>
									<li class="rs_2 orange">重置邮箱</li>
									<li class="rs_3">完成</li>
								</ul>
							</div>
							<div class="clear20"></div>
							<form name="formcn" method="post" action="" onSubmit="return myjobchk();" class="s_form_1">
								<dl class="dl_step_2">						
									<dd>
										<span class="span_l">当前密码：</span>
										<input type="password" name="password" class="text" placeholder="请输入当前使用密码" />
									</dd>
                              <dd>
										<span class="span_l">新邮箱：</span>
										<input type="text" name="newmail" class="text" placeholder="请输入新的邮箱" />
									</dd>
									<dd>
										<span class="span_l">确认新邮箱：</span>
										<input type="text" name="newmail2" class="text" placeholder="请再次输入新邮箱" />
									</dd>
									<dd>
										<input type="submit" value="变更" class="btn4 ml130" />
                                        <input name="t" type="hidden" value="y" />
									</dd>
								</dl>
							</form>
						</div>
					</div>				
					
				</div>
				<div class="clear20"></div>
				<div class="clear20"></div>
			</div>	
			
		</div>
		
		
	</div>
</div>

<div class="clear"></div>


<!--#include file="../../common/footer.asp"-->




</body>
</html>
<%if request.Form("t")="y" then
password=checkstr(inHTML(request.Form("password")))
newmail=checkstr(inHTML(request.Form("newmail")))
newmail2=checkstr(inHTML(request.Form("newmail2")))

if password="" or newmail="" or newmail2="" then
response.write"<script>alert('全部不能为空');</script>"
response.write"<script>window.history.back(-1);</script>"
response.end
end if

if newmail<>newmail2 then
response.write"<script>alert('两次输入的新邮箱不一致');</script>"
response.write"<script>window.history.back(-1);</script>"
response.end
end if


set rsx=server.createobject("adodb.recordset")
sql="select * from [user] where uid<>'"&uid&"' and mail='"&newmail&"'" 
rsx.open sql,conn,1,3
if not rsx.eof then
response.write"<script>alert('邮箱已被使用');</script>"
response.write"<script>window.history.back(-1);</script>"
response.end
end if


set rsx=server.createobject("adodb.recordset")
sql="select * from [user] where uid='"&uid&"' and password='"&md5(password)&"'" 
rsx.open sql,conn,1,3
if rsx.eof then
response.write"<script>alert('当前密码不正确');</script>"
response.write"<script>window.history.back(-1);</script>"
response.end
else
rsx("mail")=newmail
rsx.update
Response.Cookies("u")("mail") = newmail
session("code")=""
session("mobileNum")=""
session("mobilePost")=""
response.Redirect "/user/security/mail/3"
rsx.close
set rsx=nothing
end if
end if
%>